<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
             label-width="100px">
      <el-form-item label="摄像头编码" prop="name">
        <el-input v-model="queryParams.name" placeholder="请输入名称"
                  clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="摄像头名称" prop="producer">
        <el-input v-model="queryParams.producer" placeholder="请输入原材料制造商"
                  clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                   v-hasPermi="['develop:FactoryMainMaterial:add']">新增
        </el-button>
      </el-col>
    </el-row>

      <el-table :data="columns" ref="dragTable" row-key="id" >
        <el-table-column label="摄像头编码" align="center" prop="aaa"/>
        <el-table-column label="摄像头名称" align="center" prop="bbb"/>
        <el-table-column label="所属车间" align="center" prop="ggg"/>
        <el-table-column label="NVR IP地址" align="center" prop="ccc"/>
        <el-table-column label="摄像头网关" align="center" prop="ddd"/>
        <el-table-column label="状态" align="center" prop="fff"/>
        <el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="140">
          <template slot-scope="scope">
            <el-button size="mini" type="text" icon="el-icon-edit"  @click="modify(scope.row)">修改</el-button>
            <el-button size="mini" type="text" icon="el-icon-edit"  @click="look(scope.row)">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
      <yiFahuo-list ref="fahuomingxiList" @ok="getList"></yiFahuo-list>
      <lvFahuoBohui-form ref="modifyfahuomingxi" @ok="getList"></lvFahuoBohui-form>
      <look-form ref="lookForm" @ok="getList"></look-form>
  </div>
  </template>

  <script>
    import { getAction,addAction} from '@/api/manage'
    import YiFahuoList from '@/views/develop/lvYifahuomingxi/YiFahuoList'
    import LvFahuoBohuiForm from '@/views/develop/lvYifahuomingxi/module/LvFahuoBohuiForm'
    import LookForm from '@/views/develop/factory/shexiangshebei/LookForm'
    export default {
      name: "ShexiangShebeiList",
      dicts: ['goods_customer'],
      components: {
        YiFahuoList,
        LvFahuoBohuiForm,
        LookForm,
      },
      data() {
        return {
          title: "摄像设备",
          open: false,
          // 遮罩层
          loading: true,
          // 选中数组
          ids: [],
          rows: [],
          rules: {
          },
          // 非单个禁用
          single: true,
          // 非多个禁用
          multiple: true,
          // 显示搜索条件
          showSearch: true,
          // 总条数
          total: 0,
          // 销售信息管理表格数据
          dataList: [],
          columns: [{
            aaa:'sxt001',
            bbb:'1号车间东侧摄像头',
            ggg:'1号车间东侧',
            ccc:'192.168.192.108',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt002',
            bbb:'1号车间西侧摄像头',
            ggg:'1号车间西侧',
            ccc:'192.168.192.109',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt003',
            bbb:'2号车间东侧摄像头',
            ggg:'2号车间东侧',
            ccc:'192.168.192.110',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt004',
            bbb:'2号车间西侧摄像头',
            ggg:'2号车间西侧',
            ccc:'192.168.192.111',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt005',
            bbb:'3号车间东侧摄像头',
            ggg:'3号车间东侧',
            ccc:'192.168.192.112',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt006',
            bbb:'3号车间西侧摄像头',
            ggg:'3号车间西侧',
            ccc:'192.168.192.113',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt007',
            bbb:'4号车间东侧摄像头',
            ggg:'4号车间东侧',
            ccc:'192.168.192.114',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt008',
            bbb:'4号车间西侧摄像头',
            ggg:'4号车间西侧',
            ccc:'192.168.192.115',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt009',
            bbb:'5号车间东侧摄像头',
            ggg:'5号车间东侧',
            ccc:'192.168.192.116',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt008',
            bbb:'5号车间西侧摄像头',
            ggg:'5号车间西侧',
            ccc:'192.168.192.117',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt008',
            bbb:'6号车间东侧摄像头',
            ggg:'6号车间东侧',
            ccc:'192.168.192.118',
            ddd:'192.168.1.1',
            fff:'不在线',
          },{
            aaa:'sxt008',
            bbb:'6号车间西侧摄像头',
            ggg:'6号车间西侧',
            ccc:'192.168.192.119',
            ddd:'192.168.1.1',
            fff:'不在线',
          }],
          // 查询参数
          queryParams: {
            pageNum: 1,
            pageSize: 20000,
            nos: null,
            name: null,
            fahuoDate: null,
            jiaohuoDate: null,
            linkman: null,
            linktel: null,
            address: null,
            status: null,
            jingli: null,
            kehuId: null,
            kehuName: null,
            taxNo: null,
            taxCode: null,
            taxDate: null,
            taxMoney: null,
            taxShengyu: null,
            taxAllmoeny: null,
            allMoney: null,
            shengyu: null,
            yihui: null,
            daohuoDate: null,
            daohuoFile: null,
            tongzhiId: null,
            tongzhiNo: null,
            params: {},
          },
          url: {
            list:'/lvYifahuo/lvYifahuo/list',
          },
          tableMaxHeight: window.innerHeight - 320,
        };
      },
      created() {
        // this.intDictsForPrj();
        window.addEventListener('resize', this.getTableHeight);
      },
      destroyed() {
        window.removeEventListener('resize', this.getTableHeight);
      },
      methods: {
        look(row) {
          this.$refs.lookForm.showShexiangtou();
        },
        gongxuShow() {
            this.open = true
        },
        modify(row){
          this.$refs.modifyfahuomingxi.showModifyMingxi(row);
        },
        handleAdd(row){
          this.$refs.fahuomingxiList.showMingxi(row);
        },
        // 取消按钮
        cancel() {
          this.open = false;
          this.reset();
        },
        getTableHeight() {
          this.tableHeight = window.innerHeight - 320
        },
        showFahuodanList(row){
          this.queryParams.tongzhiId=row.id;
          this.open=true;
          this.getList();
        },
        /** 查询销售信息管理列表 */
        getList() {
          this.loading = true;
          getAction(this.url.list, this.queryParams).then(response => {
            this.columns = response.rows;
            this.total = response.total;
            this.loading = false;
          });
        },
        /** 搜索按钮操作 */
        handleQuery() {
          this.queryParams.pageNum = 1;
          this.getList();
        },
      }
    };
  </script>
